package org.EmploiDuTemps;
 
import android.app.Activity;
import android.content.Context;
import android.view.Display;
import android.view.WindowManager;
import android.widget.LinearLayout;

public class WeekView extends LinearLayout {
 
	private Week week;
	private int horizontalScale;
	
	public WeekView(Context context, Week week) {
		super(context);
		this.setWeek(week);
		this.setOrientation(HORIZONTAL);
		 
		WindowManager w = ((Activity) context).getWindowManager();
		Display d = w.getDefaultDisplay();
        int width = d.getWidth();
        horizontalScale = (width-15)/5;
        
        for (int i = 0; i < week.getWeek().size(); i++ ){
        	Day day = week.getWeek().get(i);
        	DayView dayLayout = new DayView(context, day, false, horizontalScale);
        	dayLayout.setMinimumWidth(horizontalScale);
        	
        	this.addView(dayLayout);
        	
        }
	}

	public void setWeek(Week week) {
		this.week = week;
	}

	public Week getWeek() {
		return week;
	}

}
